﻿import mx.utils.Delegate;

import com.gamemeal.physics.Particle;
import com.mixmedia.mx.Event;
import com.mixmedia.mx.MovieClipEvt;
/**
 * @author Colin
 */
class com.gamemeal.physics.PhyObj {
	public var centreOfMass:Particle;
	public var mc:MovieClip;
	private var isDown : Boolean;
	
	public function PhyObj(mc:MovieClipEvt) {
		this.mc = mc.mc;
		
		centreOfMass = new Particle();
		centreOfMass.d.x = this.mc._x;
		centreOfMass.d.y = this.mc._y;
		
		mc.addEventListener(Event.ENTERFRAME,Delegate.create(this,update));
	}

	public function update(time:Number){
		centreOfMass.update();
		mc._x = centreOfMass.d.x;
		mc._y = centreOfMass.d.y;
		mc._rotation = centreOfMass.θ;
	}
}